

<template>
    <div class="maskLeaderPic">
        <div class="maskLeader" v-if="showMask" >
            <div ref="optCont" class="container">
                <p class="title_code">
                    <span>选择请假人</span>
                    <i class="icon-close" @click="close"></i>
                </p>
                <ul  class="li-cont">
                    <li v-for="(item,index) in totalPeoList" 
                        @click.stop="handleClick(index,item)" 
                        :key="item.substituteId" 
                        :class='{"checked":index === checked}'
                    >
                        <span class="radio"></span><span>{{item.substituteName}}</span>
                    </li>
                </ul>
                
                <div class='button'>
                    <span @click="confirmNext"  class="confirmBtn" >下一步</span>
                </div>
            </div>
        </div>
    </div>

</template>
<script>
import Vue from 'vue'
// import { Toast} from "mint-ui";
export default {
  data(){
      return{
          value:"",
          checked:0,
          show:false,
          scrollTop:0,

      }
  },
  computed:{
      totalPeoList(){
          console.log(this.dataList,'this.dataList');
          if (this.dataList.length) {

                this.dataList.splice(0,0,{
                    substituteId:'',
                    substituteName:'我'
                });
                return this.dataList;
          }
          return [];

      }
  },
  props:{
    showMask:{
        type:Boolean,
        default:false
    },
    dataList:{
        type:Array
    },
    initPersonData:{
        type:Function
    }
  },
  watch:{
    showMask:function(newVal){
        if (newVal) {
            var self = this;
            Vue.nextTick(function(){
                console.log(self.$refs.optCont);
                self.$refs.optCont.scrollTop = self.scrollTop;
            })
        }
    }
  },
  components:{

  },
  mounted:function(){
      var self = this;

  },
  methods:{
      changeMove:function(e){
          console.log(e);
          e.stopPropagation();
      },
      scroll:function(){
          console.log('scroll');
      },
      handleClick:function(index,val,label){
        this.checked = index;
      },
      close:function(){
          history.go(-1);
        //   this.$emit("update:showMask",false);
      },
      confirmNext:function(){

        //   if (this.checked === '') {
        //         Toast({
        //             message: "请选择请假人",
        //             position: "center",
        //             className: "toastStyle",
        //             duration: 1000
        //         });
        //         return ;
        //   }

          this.$emit("initPersonData",this.checked)
          this.$emit("update:showMask",false)
      }
  }
}
</script>
<style scoped>
.maskLeaderPic{
    position:fixed;
    top:0;
    bottom:0;
    left:0;
    right:0;
    background-color: #7E7E7E;
    z-index:1000;
}
.maskLeader{
    overflow: hidden;
    background-color:#fff;
    position: absolute;;
    bottom:0px;
    margin:auto auto;
    top:0px;
    height:6rem;
    width:80%;
    left:0;
    right:0;
    border-radius: 0.16rem;
    text-align:center;
}
.maskLeader .li-cont li.checked{
    color:#4B81E9;
}

.maskLeader .checked>.radio {
    background-color: #4B81E9;
    border-color: #4B81E9;
}
.maskLeader .checked>.radio:after {
    background-color: #fff;
    -webkit-transform: scale(1);
    transform: scale(1);
}
.radio:after {
    content: " ";
    border-radius: 100%;
    top: 5px;
    left: 5px;
    position: absolute;
    width: 8px;
    height: 8px;
    -webkit-transition: -webkit-transform .2s;
    transition: -webkit-transform .2s;
    transition: transform .2s;
    transition: transform .2s,-webkit-transform .2s;
    -webkit-transform: scale(0);
    transform: scale(0);
}
.radio {
    box-sizing: border-box;
    display: inline-block;
    background-color: #fff;
    border-radius: 100%;
    border: 1px solid #ccc;
    position: relative;
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin-right:0.2rem;
}
.maskLeader .title_code{
    height: 1rem;
    line-height: 1rem;
    font-size:0.32rem;
    font-weight: 600;
    position: relative;
    margin-bottom:0.2rem;
    color:#717171;
    letter-spacing: 0.02rem;
}
.maskLeader .title_code i{
    position: absolute;
    right:0.3rem;
    top:0.34rem;
    font-size:0.32rem;
    color: rgb(148, 142, 142);
}
.maskLeader .li-cont{
    text-align:left;
    margin-left:8%;
    min-height: 3.4rem;
}
.maskLeader .li-cont li{
    line-height:0.8rem;
    height:0.8rem;
    color:#333333;
}
.button {
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;

}

.button .confirmBtn{
    display:inline-block;
    width: 1.7rem;
    height:0.6rem;
    line-height:0.6rem;
    text-align:center;
    background-color: #4B81E9;
    color:#fff;
    border-radius:0.3rem;
}

</style>